package 查找算法;

/*
* 顺序查找
* */
public class SeqSearch {
    public static void main(String[] args) {
        int[] arr = {3,5,1,7,9,10,24,4535,24,-32};
        int value = -32;
        int search = search(arr, value);
        if(search == -1){
            System.out.println("没找到");
        }else{
            System.out.println("找到了,下标为"+search);
        }
    }
    private static int search(int[] arr,int value) {
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == value){
                return i;
            }
        }
        return -1;
    }
}
